Ext.define('NIM.view.UserAdministration.Group_management', {
    extend: 'Ext.panel.Panel',
    alias: 'widget.user_GroupAdministration',
    id: 'user_GroupAdministration',
    title : 'Group Management',
    border: false,
    closable: true,
    height: 590,
    layout: {
        type: 'border'
    },

    items: [
         {
                xtype: 'form',
                id: 'ConfigGroupList',
                title: 'Group Form',
                region: 'west',
                margin: '5 5 5 5',
                method: 'POST',
         		url: './Services/Security/Group/Add',
                collapsed: true,
                collapsible: true,
                autoScroll: true,
                width: 650,
                items: [
                    {
          		          xtype : 'hiddenfield',
          		          cls : 'black',
          		          id : 'cekstatus',
          		          name : 'CEKSTATUS',
          		          margin : '5 10 5 25',
          		          labelWidth : 100 / 1366 * screen.width,
          		          width : 300 / 1366 * screen.width,
          		          fieldLabel : 'Site ID',
          		          msgTarget : 'title',
          		          allowBlank : true,
          		          validateBlank : false
          	
          	       },
    	           {
			            xtype: 'textfield',
		            	cls: 'black',
		            	id: 'GroupnameList',
		            	name : 'GROUPNAME',
			            emptyText: 'Input Your Groupname',
			            margin: '15 10 10 10',
			            labelWidth: 90/1366*screen.width,
			            width: 325/1366*screen.width,
			            fieldLabel: 'GROUPNAME',
			            msgTarget: 'title',
		                editable: false,
			         	allowBlank: false, 
			            allowOnlyWhitespace: false
    	           },
    	           {
			            xtype: 'textfield',
		            	cls: 'black',
		            	name : 'ALIAS',
			            emptyText: 'Input Your Alias',
			            margin: '10 10 10 10',
		            	labelWidth: 90/1366*screen.width,
			            width: 325/1366*screen.width,
			            fieldLabel: 'ALIAS',
			            msgTarget: 'title',
		                editable: false,
			         	allowBlank: false, 
			            allowOnlyWhitespace: false
    	           },
    	           {
    	                xtype: 'textareafield',
    	                grow: true,
    	                name: 'DESCRIPTION',
    	                fieldLabel: 'GROUP DESC',
    	                emptyText: 'Input Your Group Description',
    	                margin: '10 10 10 10',
    	                labelWidth: 90/1366*screen.width,
    	                width: 325/1366*screen.width,
    	                msgTarget: 'title',
    	                editable: false,
    	                allowBlank: true, 
    	                allowOnlyWhitespace: false
    	           },
    	           {
    	        	   xtype: 'fieldcontainer',
    	               cls: 'black',
    	               margin: '10 10 10 10',
    	               fieldLabel : 'ACTIVE',
    	               labelWidth: 90/1366*screen.width,
    	               width: 325/1366*screen.width,
    	               defaultType: 'radiofield',
    	               defaults: {
    	                   flex: 1
    	               },
    	               layout: 'hbox',
    	               items: [
    	                   {
    	                       boxLabel  : 'Yes',
    	                       name      : 'ACTIVE',
    	                       inputValue: '1'
    	                   }, 
    	                   {
    	                       boxLabel  : 'No',
    	                       name      : 'ACTIVE',
    	                       inputValue: '0'
    	                   }
    	               ]
    	           },
    	           {
                        xtype: 'itemselector',
                        id: 'GroupSelectorList',
                        labelClsExtra : 'tes',
                        labelAlign : 'left',
                        width: 600/1366*screen.width,
                        height: 200/768*screen.height,
                        margin: '5 10 10 10',
                        labelWidth: 90/1366*screen.width,
                        fieldLabel: 'GROUPS',
                        store: 'AssetDataMaster.Regional',
                        allowBlank: false,
                        displayField: 'region_description',
                        valueField: 'region_code',
                        name      :'regional',
                        fromTitle: 'Available',
                        toTitle: 'Selected',
                        msgTarget: 'side',
    	           },
    	           {
    	               xtype: 'fieldset',
    	               title: 'Privillage',
    	               heigth: 180,
    	               margin: '10 10 10 10',
    	               width : 600,
    	               items: [{
    	            	   xtype: 'fieldset',
    	            	   title: 'Asset Data Master',
    	            	   items:[{
			    	               xtype: 'checkboxgroup',
			    	               fieldLabel: 'Site List',
			    	               labelAlign : 'left',
			    	               labelClsExtra : 'tes',
			    	               margin: '10 10 10 10',
			    	               labelWidth: 115/1366*screen.width,
			    	               columns: 4,
			    	               items: [
			    	                   { boxLabel: 'View ', 	name: 'NIM.SITE.VIEW', inputValue: 'NIM.SITE.VIEW' },
			    	                   { boxLabel: 'Add', 		name: 'NIM.SITE.ADD', inputValue: 'NIM.SITE.ADD'},
			    	                   { boxLabel: 'Edit',		name: 'NIM.SITE.EDIT', inputValue: 'NIM.SITE.EDIT' },
			    	                   { boxLabel: 'Delete', 	name: 'NIM.SITE.DELETE', inputValue: 'NIM.SITE.DELETE' }
			    	               ]
			    	           },]
    	            	   
    	               },
    	               {
    	            	   xtype: 'fieldset',
    	            	   title: 'Asset Change',
    	            	   items:[{
			    	               xtype: 'checkboxgroup',
			    	               fieldLabel: 'Relocation Site',
			    	               labelAlign : 'left',
			    	               labelClsExtra : 'tes',
			    	               margin: '10 10 10 10',
			    	               labelWidth: 115/1366*screen.width,
			    	               columns: 4,
			    	               items: [
			    	                       { boxLabel: 'View ', 	name: 'NIM.RELOCATIONSITE.VIEW', inputValue: 'NIM.RELOCATIONSITE.VIEW' },
				    	                   { boxLabel: 'Add', 		name: 'NIM.RELOCATIONSITE.ADD', inputValue: 'NIM.RELOCATIONSITE.ADD'},
				    	                   { boxLabel: 'Edit',		name: 'NIM.RELOCATIONSITE.EDIT', inputValue: 'NIM.RELOCATIONSITE.EDIT' },
				    	                   { boxLabel: 'Delete', 	name: 'NIM.RELOCATIONSITE.DELETE', inputValue: 'NIM.RELOCATIONSITE.DELETE' }
			    	               ]
			    	           },
			    	           {
			    	               xtype: 'checkboxgroup',
			    	               fieldLabel: 'Relocation NE',
			    	               labelAlign : 'left',
			    	               labelClsExtra : 'tes',
			    	               margin: '10 10 10 10',
			    	               labelWidth: 115/1366*screen.width,
			    	               columns: 4,
			    	               items: [
			    	                       { boxLabel: 'View ', 	name: 'NIM.RELOCATIONNE.VIEW', inputValue: 'NIM.RELOCATIONNE.VIEW' },
				    	                   { boxLabel: 'Add', 		name: 'NIM.RELOCATIONNE.ADD', inputValue: 'NIM.RELOCATIONNE.ADD'},
				    	                   { boxLabel: 'Edit',		name: 'NIM.RELOCATIONNE.EDIT', inputValue: 'NIM.RELOCATIONNE.EDIT' },
				    	                   { boxLabel: 'Delete', 	name: 'NIM.RELOCATIONNE.DELETE', inputValue: 'NIM.RELOCATIONNE.DELETE' }
			    	               ]
			    	           },
			    	           {
			    	               xtype: 'checkboxgroup',
			    	               fieldLabel: 'Dismantle Site',
			    	               labelAlign : 'left',
			    	               labelClsExtra : 'tes',
			    	               margin: '10 10 10 10',
			    	               labelWidth: 115/1366*screen.width,
			    	               columns: 4,
			    	               items: [
											{ boxLabel: 'View ', 	name: 'NIM.DISMANTLESITE.VIEW', 	inputValue: 'NIM.DISMANTLESITE.VIEW' },
											{ boxLabel: 'Add', 		name: 'NIM.DISMANTLESITE.ADD',  	inputValue: 'NIM.DISMANTLESITE.ADD'},
											{ boxLabel: 'Edit',		name: 'NIM.DISMANTLESITE.EDIT', 	inputValue: 'NIM.DISMANTLESITE.EDIT' },
											{ boxLabel: 'Delete', 	name: 'NIM.DISMANTLESITE.DELETE', 	inputValue: 'NIM.DISMANTLESITE.DELETE' }
			    	               ]
			    	           },
			    	           {
			    	               xtype: 'checkboxgroup',
			    	               fieldLabel: 'Dismantle NE',
			    	               labelAlign : 'left',
			    	               labelClsExtra : 'tes',
			    	               margin: '10 10 10 10',
			    	               labelWidth: 115/1366*screen.width,
			    	               columns: 4,
			    	               items: [
											{ boxLabel: 'View ', 	name: 'NIM.DISMANTLENE.VIEW', 	inputValue: 'NIM.DISMANTLENE.VIEW' },
											{ boxLabel: 'Add', 		name: 'NIM.DISMANTLENE.ADD',  	inputValue: 'NIM.DISMANTLENE.ADD'},
											{ boxLabel: 'Edit',		name: 'NIM.DISMANTLENE.EDIT', 	inputValue: 'NIM.DISMANTLENE.EDIT' },
											{ boxLabel: 'Delete', 	name: 'NIM.DISMANTLENE.DELETE', inputValue: 'NIM.DISMANTLENE.DELETE' }
			    	               ]
			    	           },
			    	           {
			    	               xtype: 'checkboxgroup',
			    	               fieldLabel: 'Henti Operasi Site',
			    	               labelAlign : 'left',
			    	               labelClsExtra : 'tes',
			    	               margin: '10 10 10 10',
			    	               labelWidth: 115/1366*screen.width,
			    	               columns: 4,
			    	               items: [
											{ boxLabel: 'View ', 	name: 'NIM.HENTIOPERASISITE.VIEW', 	inputValue: 'NIM.HENTIOPERASISITE.VIEW' },
											{ boxLabel: 'Add', 		name: 'NIM.HENTIOPERASISITE.ADD',  	inputValue: 'NIM.HENTIOPERASISITE.ADD'},
											{ boxLabel: 'Edit',		name: 'NIM.HENTIOPERASISITE.EDIT', 	inputValue: 'NIM.HENTIOPERASISITE.EDIT' },
											{ boxLabel: 'Delete', 	name: 'NIM.HENTIOPERASISITE.DELETE',inputValue: 'NIM.HENTIOPERASISITE.DELETE' }
			    	               ]
			    	           },
			    	           {
			    	               xtype: 'checkboxgroup',
			    	               fieldLabel: 'Henti Operasi NE',
			    	               labelAlign : 'left',
			    	               labelClsExtra : 'tes',
			    	               margin: '10 10 10 10',
			    	               labelWidth: 115/1366*screen.width,
			    	               columns: 4,
			    	               items: [
											{ boxLabel: 'View ', 	name: 'NIM.HENTIOPERASINE.VIEW', 	inputValue: 'NIM.HENTIOPERASINE.VIEW' },
											{ boxLabel: 'Add', 		name: 'NIM.HENTIOPERASINE.ADD',  	inputValue: 'NIM.HENTIOPERASINE.ADD'},
											{ boxLabel: 'Edit',		name: 'NIM.HENTIOPERASINE.EDIT', 	inputValue: 'NIM.HENTIOPERASINE.EDIT' },
											{ boxLabel: 'Delete', 	name: 'NIM.HENTIOPERASINE.DELETE',  inputValue: 'NIM.HENTIOPERASINE.DELETE' }
			    	               ]
			    	           },
			    	           {
			    	               xtype: 'checkboxgroup',
			    	               fieldLabel: 'Asset Hilang',
			    	               labelAlign : 'left',
			    	               labelClsExtra : 'tes',
			    	               margin: '10 10 10 10',
			    	               labelWidth: 115/1366*screen.width,
			    	               columns: 4,
			    	               items: [
											{ boxLabel: 'View ', 	name: 'NIM.ASSETHILANG.VIEW', 	inputValue: 'NIM.ASSETHILANG.VIEW' },
											{ boxLabel: 'Add', 		name: 'NIM.ASSETHILANG.ADD',  	inputValue: 'NIM.ASSETHILANG.ADD'},
											{ boxLabel: 'Edit',		name: 'NIM.ASSETHILANG.EDIT', 	inputValue: 'NIM.ASSETHILANG.EDIT' },
											{ boxLabel: 'Delete', 	name: 'NIM.ASSETHILANG.DELETE', inputValue: 'NIM.ASSETHILANG.DELETE' }
			    	               ]
			    	           }]
    	            	   
    	               },
    	               {
    	            	   xtype: 'fieldset',
    	            	   title: 'Administration',
    	            	   items:[{
			    	               xtype: 'checkboxgroup',
			    	               fieldLabel: 'Asset Categories',
			    	               labelAlign : 'left',
			    	               labelClsExtra : 'tes',
			    	               margin: '0 10 0 5',
			    	               labelWidth: 115/1366*screen.width,
			    	               columns: 4,
			    	               items: [
											{ boxLabel: 'View ', 	name: 'NIM.CATEGORIES.VIEW', 	inputValue: 'NIM.CATEGORIES.VIEW' },
											{ boxLabel: 'Add', 		name: 'NIM.CATEGORIES.ADD',  	inputValue: 'NIM.CATEGORIES.ADD'},
											{ boxLabel: 'Edit',		name: 'NIM.CATEGORIES.EDIT', 	inputValue: 'NIM.CATEGORIES.EDIT' },
											{ boxLabel: 'Delete', 	name: 'NIM.CATEGORIES.DELETE',	inputValue: 'NIM.CATEGORIES.DELETE' }
			    	               ]
			    	           },
			    	           {
			    	               xtype: 'checkboxgroup',
			    	               fieldLabel: 'Sub Categories',
			    	               labelAlign : 'left',
			    	               labelClsExtra : 'tes',
			    	               margin: '0 10 0 5',
			    	               labelWidth: 115/1366*screen.width,
			    	               columns: 4,
			    	               items: [
											{ boxLabel: 'View ', 	name: 'NIM.SUBCATEGORIES.VIEW', 	inputValue: 'NIM.SUBCATEGORIES.VIEW' },
											{ boxLabel: 'Add', 		name: 'NIM.SUBCATEGORIES.ADD',  	inputValue: 'NIM.SUBCATEGORIES.ADD'},
											{ boxLabel: 'Edit',		name: 'NIM.SUBCATEGORIES.EDIT', 	inputValue: 'NIM.SUBCATEGORIES.EDIT' },
											{ boxLabel: 'Delete', 	name: 'NIM.SUBCATEGORIES.DELETE',	inputValue: 'NIM.SUBCATEGORIES.DELETE' }
			    	               ]
			    	           },
			    	           {
			    	               xtype: 'checkboxgroup',
			    	               fieldLabel: 'Change Reason',
			    	               labelAlign : 'left',
			    	               labelClsExtra : 'tes',
			    	               margin: '0 10 0 5',
			    	               labelWidth: 115/1366*screen.width,
			    	               columns: 4, 
			    	               items: [
											{ boxLabel: 'View ', 	name: 'NIM.CHANGEREASON.VIEW', 	inputValue: 'NIM.CHANGEREASON.VIEW' },
											{ boxLabel: 'Add', 		name: 'NIM.CHANGEREASON.ADD',  	inputValue: 'NIM.CHANGEREASON.ADD'},
											{ boxLabel: 'Edit',		name: 'NIM.CHANGEREASON.EDIT', 	inputValue: 'NIM.CHANGEREASON.EDIT' },
											{ boxLabel: 'Delete', 	name: 'NIM.CHANGEREASON.DELETE',inputValue: 'NIM.CHANGEREASON.DELETE' }
			    	               ]
			    	           },
			    	           {
			    	               xtype: 'checkboxgroup',
			    	               fieldLabel: 'WareHouse',
			    	               labelAlign : 'left',
			    	               labelClsExtra : 'tes',
			    	               margin: '0 10 0 5',
			    	               labelWidth: 115/1366*screen.width,
			    	               columns: 4,
			    	               items: [
											{ boxLabel: 'View ', 	name: 'NIM.WAREHOUSE.VIEW', 	inputValue: 'NIM.WAREHOUSE.VIEW' },
											{ boxLabel: 'Add', 		name: 'NIM.WAREHOUSE.ADD',  	inputValue: 'NIM.WAREHOUSE.ADD'},
											{ boxLabel: 'Edit',		name: 'NIM.WAREHOUSE.EDIT', 	inputValue: 'NIM.WAREHOUSE.EDIT' },
											{ boxLabel: 'Delete', 	name: 'NIM.WAREHOUSE.DELETE',	inputValue: 'NIM.WAREHOUSE.DELETE' }
			    	               ]
			    	           }]
    	            	   
    	               },
    	               {
    	            	   xtype: 'fieldset',
    	            	   title: 'User Management',
    	            	   items:[{
			    	               xtype: 'checkboxgroup',
			    	               fieldLabel: 'Asset Categories',
			    	               labelAlign : 'left',
			    	               labelClsExtra : 'tes',
			    	               margin: '0 10 0 5',
			    	               labelWidth: 115/1366*screen.width,
			    	               columns: 4,
			    	               items: [
											{ boxLabel: 'View ', 	name: 'NIM.USER.VIEW', 	inputValue: 'NIM.USER.VIEW' },
											{ boxLabel: 'Add', 		name: 'NIM.USER.ADD',  	inputValue: 'NIM.USER.ADD'},
											{ boxLabel: 'Edit',		name: 'NIM.USER.EDIT', 	inputValue: 'NIM.USER.EDIT' },
											{ boxLabel: 'Delete', 	name: 'NIM.USER.DELETE',inputValue: 'NIM.USER.DELETE' }]
			    	           },
			    	           {
			    	               xtype: 'checkboxgroup',
			    	               fieldLabel: 'Sub Categories',
			    	               labelAlign : 'left',
			    	               labelClsExtra : 'tes',
			    	               margin: '0 10 0 5',
			    	               labelWidth: 115/1366*screen.width,
			    	               columns: 4,
			    	               items: [
											{ boxLabel: 'View ', 	name: 'NIM.GROUP.VIEW', 	inputValue: 'NIM.GROUP.VIEW' },
											{ boxLabel: 'Add', 		name: 'NIM.GROUP.ADD',  	inputValue: 'NIM.GROUP.ADD'},
											{ boxLabel: 'Edit',		name: 'NIM.GROUP.EDIT', 	inputValue: 'NIM.GROUP.EDIT' },
											{ boxLabel: 'Delete', 	name: 'NIM.GROUP.DELETE',	inputValue: 'NIM.GROUP.DELETE' }]
			    	           }]
    	            	   
    	               }]
    	           },
    	               
    	        
                   
    	           {
		                xtype: 'button',
		                id: 'ButtongroupList',
			            margin: '5 10 10 10',
		                width: 50/1366*screen.width,
		                text: 'Insert',
		                handler: function () {
	                        this.up('form').getForm().submit({
	                            waitMsg: 'Please Wait ....',
	                            success: function (form, action) {
	                                afterSubmitInformation(form, action);
	                                this.up('form').getForm().reset();
	                                Ext.getCmp('ButtongroupList').setText('Insert');
	                                Ext.getCmp ('GroupnameList').setDisabled(true);
	                            },
	                            failure: function (form, action) {
	                                afterSubmitInformation(form, action);
	                                Ext.getStore('User_Management.Listgroup_Store').getProxy().url = "./Services/Security/Group/List";
	                            	Ext.getStore('User_Management.Listgroup_Store').load();
	                                Ext.getCmp('ConfigGroupList').getForm().reset();
	                                Ext.getCmp('ButtongroupList').setText('Insert');
	                                Ext.getCmp ('GroupnameList').setDisabled(false);
	                             
	                            }
	                        });
	                       
	                    },
    	           },
    	           {
		                xtype: 'button',
			            margin: '5 10 10 0',
		            	width: 50/1366*screen.width,
		                text: 'Clear',
		            	handler: function() {
		            		Ext.getCmp('UsernameList').setValue("");
	                		Ext.getCmp('AliasList').setValue("");
	                		Ext.getCmp('EmailList').setValue("");
	                		Ext.getCmp('PhoneList').setValue("");
	                		Ext.getCmp('YesActiveList').setValue(false);
	                		Ext.getCmp('NoActiveList').setValue(false);
    	        	   		Ext.getCmp('ButtongroupList').setText("Insert");
		            	}
    	           }
                ]
            },
  
   
    {
            xtype: 'gridpanel',
            region: 'center',
            height: 590,
            id    :'tableGroupList',
            width : 400,
            titleAlign :'center',
            margin: '5 5 5 0',
            border : true,
            forceFit: true,
            columnLines: true,
            selType: 'checkboxmodel',
            store: 'User_Management.Listgroup_Store',
            title: 'Group List',
		    columns: [
					    { dataIndex: 'GROUPNAME', text: 'Groupname', align: 'center' },
					    { dataIndex: 'ALIAS', text: 'Alias', align: 'center' },
					    { dataIndex: 'DESCRIPTION', text: 'Description', align: 'center' },
					    {
	                	    xtype: 'actioncolumn',
	                	    text : 'Status',
	                	    align : 'center',
	                	    renderer: function (value, metadata, record) {
	                	    	var document = record.get('ACTIVE');
	                	    	console.log (document);
	                	    	if (document=="1"){
	                	    		this.items[0].icon = 'images/enable.png';
	                	    	}else{
	                	    		this.items[0].icon = 'images/close.png';
	                	    	}
	                	    }
	                	}
				     ],
				    
             dockedItems: [
                {
                    xtype: 'pagingtoolbar',
                    dock: 'bottom',
                    store: 'User_Management.Listgroup_Store',
                    displayInfo: true
                },
                {
                    xtype: 'toolbar',
                    dock: 'top',
                    items: [
                        {
                            xtype: 'textfield',
                            fieldLabel: 'KEYWORD',
                            id: 'keywordgroup',
                            margin: '0 0 0 10',
                            enableKeyEvents: true,
                            listeners: {
                                keypress: function (form, e) {
                                    if (e.getKey() == 13) {
                                        SearchAssetCategory();
                                    }

                                }
                            }
                        },
                        {
                            xtype: 'button',
                            text: 'SEARCH',
                            margin: '0 30 0 0',
                            handler: function () {
                        	var keyword = Ext.getCmp('keywordgroup').getValue();
                        	Ext.getStore('User_Management.Listgroup_Store').getProxy().url = "./Services/Security/Group/Search?groupname="+keyword;
                        	Ext.getStore('User_Management.Listgroup_Store').load();
                            }
                        },
                        {
                            xtype: 'button',
                            text: 'ADD NEW',
                            margin: '0 20 0 0',
                            handler: function () {
                                if (Ext.getCmp('ConfigGroupList').hidden == true)
                                    Ext.getCmp('ConfigGroupList').toggleCollapse(true);
                                Ext.getCmp ("ButtonUserList").setText("Insert");
                                Ext.getCmp ('GroupnameList').setDisabled(false);
                            }

                        },
                        {
                            xtype: 'button',
                            text: 'DELETE',
                            margin: '0 20 0 0',
                            handler: function () {
                            	var rec = Ext.getCmp('tableGroupList').getSelectionModel().getSelection();
                            	if (rec.length>0){
                            		  Ext.MessageBox.confirm('Delete', 'Are you sure ?', function(btn) {
                            		        if (btn === 'yes') {
                            		        	 for (var i = 0; i<rec.length ; i++){
                            		     	    	var id = rec[i].get('GROUPNAME');
                            		     	    	var data = {GROUPNAME: id};
                            		     	    	var url  = './Services/Security/Group/Delete';
                            		     	    	PostData(data,url,"Delete");
                            		     	    	Ext.getStore('User_Management.Listgroup_Store').getProxy().url = "./Services/Security/Group/List";
                 	                            	Ext.getStore('User_Management.Listgroup_Store').load();
                            		     	    }
                            		        
                            		        }
                            		    });
                            	}else{
                                	Ext.MessageBox.show({
                            		 	title: 'WARNING!',
                            	        msg: 'No Data Selected',
                            	        icon: Ext.Msg.WARNING
                            	    });	
                                }
                            }
                        },
                        {
                            xtype: 'button',
                            text: 'REFRESH',
                            handler: function () {
                        	Ext.getStore('User_Management.Listgroup_Store').getProxy().url = "./Services/Security/Group/List";
                        	Ext.getStore('User_Management.Listgroup_Store').load();
                            }
                        }
                    ]
                }
            ],
            
			listeners: {
					    itemdblclick: function(grid, record) {
					    	var groupname = record.get('GROUPNAME');
					    	Ext.getCmp ('GroupnameList').setDisabled(true);
					    	Ext.getCmp("cekstatus").setValue(groupname);
					    	Ext.getCmp ("ButtongroupList").setText("Update");
		                		if(Ext.getCmp('ConfigGroupList').hidden == true) Ext.getCmp('ConfigGroupList').toggleCollapse(true);
		                		Ext.Ajax.request({
		                		    method: "GET",
		                		    dataType: "json",
		                		    url: "./Services/Security//Group/GetGroup?groupname="+groupname,
		                		    async: false	,
		                		    success: function(c) {
		                		    	var jsonResults= $.parseJSON(c.responseText);
		                		    	data = jsonResults.item[0];
		                		    	console.log (data);
		                		    	Ext.getCmp('ConfigGroupList').getForm().setValues(data);
		                		        }
		                		    });	
		                		
		                		  var url = './Services/Security/Group/Region/'+groupname;
		                          var userall = Ext.create('Ext.data.Store', {
		                              fields: ['REGIONAL'],
		                              autoLoad: true,
		                              proxy: {
		                                  type: 'ajax',
		                                  url: url,
		                                  reader: {
		                                      type: 'json',
		                                      root: 'item',
		                                      successProperty: 'success'
		                                  }
		                              }
		                          });
		                          userall.on({
		                              load: function() {
		                                  var data_user = userall.getRange();
		                                  var selected = [];
		                                  for (var i = 0; i < data_user.length; i++) {
		                                      var id_coll = data_user[i].get('REGIONAL');
		                                      selected.push(id_coll);
		                                  }
		                                  Ext.getCmp('GroupSelectorList').setValue(selected);
		                                  //Ext.getCmp('select').setValue(value_selected);
		                              }
		                          });
		                		
		                		
		                		
					        
					    },
					    afterrender: function (){
					    	Ext.getStore('User_Management.Listgroup_Store').load();
					    	
					    }
					    
					},
	   
        }
    ]

});